`:top
`!Fish`! (`!friendly interactive shell`!; stylized in lowercase) is a `F33f`_`[Unix-like shell`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Unix_shell]`_`f with a focus on interactivity and usability. Fish is designed to be feature-rich by default, rather than highly configurable,`:cite-ref-5[`F5bf`_`[5`#cite-note-5]`_`f] and does not adhere to `F33f`_`[POSIX`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=POSIX]`_`f shell standards by design.`:cite-ref-6[`F5bf`_`[6`#cite-note-6]`_`f]
>>Contents
• `F0af`_`[Features`#features]`_`f
• `F0af`_`[Syntax`#syntax]`_`f
• `F0af`_`[No implicit subshell`#no-implicit-subshell]`_`f
• `F0af`_`[Universal variables`#universal-variables]`_`f
• `F0af`_`[Other features`#other-features]`_`f
• `F0af`_`[Bash/fish translation table`#bash-fish-translation-table]`_`f
• `F0af`_`[See also`#see-also]`_`f
• `F0af`_`[References`#references]`_`f
• `F0af`_`[External links`#external-links]`_`f
-─
>>Features
Fish displays `F33f`_`[incremental suggestions`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Incremental_search]`_`f as the user types, based on command history and the current directory. This functions similarly to `F33f`_`[Bash`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Bash_(Unix_shell)]`_`f's `B100`F9d9Ctrl`f`b+`B100`F9d9R`f`b history search, but is always on, giving the user continuous feedback while typing commands. Fish also includes feature-rich `F33f`_`[tab completion`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Command-line_completion]`_`f, with support for expanding file paths (with `F33f`_`[wildcards`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Wildcard_character]`_`f and `F33f`_`[brace expansion`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Bash_(Unix_shell)]`_`f), `F33f`_`[environment variables`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Environment_variable]`_`f, and command-specific completions. Command-specific completions, including options with descriptions, can be to some extent generated from the commands' `F33f`_`[man pages`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Man_page]`_`f, but custom completions can also be included with software or written by users of the shell.`:cite-ref-7[`F5bf`_`[7`#cite-note-7]`_`f]
The creator of Fish preferred to add new features as commands rather than syntax. This made features more `F33f`_`[discoverable`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Discoverability]`_`f, as the built-in features allow searching commands with options and help texts. `F33f`_`[Functions`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Subroutine]`_`f can also include human readable descriptions. A special `*help`* command gives access to all the fish documentation in the user's `F33f`_`[web browser`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Web_browser]`_`f.`:cite-ref-8[`F5bf`_`[8`#cite-note-8]`_`f]
>>Syntax
The syntax resembles a `F33f`_`[POSIX`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=POSIX]`_`f compatible shell (such as Bash), but deviates in many ways`:cite-ref-indepthfish-9-0[`F5bf`_`[9`#cite-note-indepthfish-9]`_`f]
`B100`F9d9# Variable assignment`f`b
`B100`F9d9#`f`b
`B100`F9d9# Set the variable 'foo' to the value 'bar'.`f`b
`B100`F9d9# Fish doesn't use the = operator, which is inherently whitespace sensitive.`f`b
`B100`F9d9# The 'set' command extends to work with arrays, scoping, etc.`f`b
`B100`F9d9`f`b
`B100`F9d9> set foo bar`f`b
`B100`F9d9> echo $foo`f`b
`B100`F9d9bar`f`b
`B100`F9d9`f`b
`B100`F9d9# Command substitution`f`b
`B100`F9d9#`f`b
`B100`F9d9# Assign the output of the command 'pwd' into the variable 'wd'.`f`b
`B100`F9d9# Fish doesn't use backticks (\`\`), which can't be nested and may be confused with single quotes (' ').`f`b
`B100`F9d9`f`b
`B100`F9d9> set wd (pwd)`f`b
`B100`F9d9> set wd $(pwd) # since version 3.4`f`b
`B100`F9d9> echo $wd`f`b
`B100`F9d9~`f`b
`B100`F9d9`f`b
`B100`F9d9# Array variables. 'A' becomes an array with 5 values:`f`b
`B100`F9d9> set A 3 5 7 9 12`f`b
`B100`F9d9# Array slicing. 'B' becomes the first two elements of 'A':`f`b
`B100`F9d9> set B $A[1 2]`f`b
`B100`F9d9> echo $B`f`b
`B100`F9d93 5`f`b
`B100`F9d9# You can index with other arrays and even command`f`b
`B100`F9d9# substitution output:`f`b
`B100`F9d9> echo $A[(seq 3)]`f`b
`B100`F9d93 5 7`f`b
`B100`F9d9# Erase the third and fifth elements of 'A'`f`b
`B100`F9d9> set --erase A[$B]`f`b
`B100`F9d9> echo $A`f`b
`B100`F9d93 5 9`f`b
`B100`F9d9`f`b
`B100`F9d9# for-loop, convert jpegs to pngs`f`b
`B100`F9d9> for i in *.jpg`f`b
`B100`F9d9 convert $i (basename $i .jpg).png`f`b
`B100`F9d9 end`f`b
`B100`F9d9`f`b
`B100`F9d9# fish supports multi-line history and editing.`f`b
`B100`F9d9# Semicolons work like newlines:`f`b
`B100`F9d9> for i in *.jpg; convert $i (basename $i .jpg).png; end`f`b
`B100`F9d9`f`b
`B100`F9d9`f`b
`B100`F9d9`f`b
`B100`F9d9# while-loop, read lines /etc/passwd and output the fifth`f`b
`B100`F9d9# colon-separated field from the file. This should be`f`b
`B100`F9d9# the user description.`f`b
`B100`F9d9> while read line`f`b
`B100`F9d9 set arr (echo $line|tr : \\n)`f`b
`B100`F9d9 echo $arr[5]`f`b
`B100`F9d9 end < /etc/passwd`f`b
`B100`F9d9`f`b
`B100`F9d9# String replacement (replacing all i by I)`f`b
`B100`F9d9> string replace -a "i" "I" "Wikipedia"`f`b
`B100`F9d9WIkIpedIa`f`b
>>>No implicit subshell
Some language constructs, like `F33f`_`[pipelines`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Pipeline_(software)]`_`f, `F33f`_`[functions`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Subroutine]`_`f and `F33f`_`[loops`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Control_flow]`_`f, have been implemented using so called `F33f`_`[subshells`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Child_process]`_`f in other `F33f`_`[shell`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Shell_(computing)]`_`f languages. Subshells are child programs that run a few commands in order to perform a task, then exit back to the parent shell. This implementation detail typically has the side effect that any state changes made in the subshell, such as variable assignments, do not propagate to the main shell. Fish never creates subshells for language features; all `F33f`_`[builtins`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Shell_builtin]`_`f happen within the parent shell.
`B100`F9d9# This will not work in many other shells, since the 'read' builtin`f`b
`B100`F9d9# will run in its own subshell. In Bash, the right side of the pipe`f`b
`B100`F9d9# can't have any side effects. In ksh, the below command works, but`f`b
`B100`F9d9# the left side can't have any side effects. In fish and zsh, both`f`b
`B100`F9d9# sides can have side effects.`f`b
`B100`F9d9> cat *.txt | read line`f`b
>>>>Variable assignment example
This Bash example doesn't do what it seems: because the loop body is a subshell, the update to `B100`F9d9$found`f`b is not persistent.
`B100`F9d9found=''`f`b
`B100`F9d9cat /etc/fstab | while read dev mnt rest; do`f`b
`B100`F9d9 if test "$mnt" = "/"; then`f`b
`B100`F9d9 found="$dev"`f`b
`B100`F9d9 fi`f`b
`B100`F9d9done`f`b
Workaround:
`B100`F9d9found=''`f`b
`B100`F9d9while read dev mnt rest; do`f`b
`B100`F9d9 if test "$mnt" = "/"; then`f`b
`B100`F9d9 found="$dev"`f`b
`B100`F9d9 fi`f`b
`B100`F9d9done < /etc/fstab`f`b
Fish example:
`B100`F9d9set found ''`f`b
`B100`F9d9cat /etc/fstab | while read dev mnt rest`f`b
`B100`F9d9 if test "$mnt" = "/"`f`b
`B100`F9d9 set found $dev`f`b
`B100`F9d9 end`f`b
`B100`F9d9end`f`b
>>Universal variables
Fish has a feature known as universal variables, which allows a user to permanently assign a value to a variable across all the user's running fish shells. The variable value is remembered across logouts and reboots, and updates are immediately propagated to all running shells.
`B100`F9d9# This will make emacs the default text editor. The '--universal' (or '-U') tells fish to`f`b
`B100`F9d9# make this a universal variable.`f`b
`B100`F9d9> set --universal EDITOR emacs`f`b
`B100`F9d9`f`b
`B100`F9d9# This command will make the current working directory part of the fish`f`b
`B100`F9d9# prompt turn blue on all running fish instances.`f`b
`B100`F9d9> set --universal fish_color_cwd blue`f`b
>>Other features
• Advanced tab completion (with support for writing custom completions).
• `F33f`_`[Syntax highlighting`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Syntax_highlighting]`_`f with extensive error checking.
• Support for the `F33f`_`[X`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=X_Window_System]`_`f `F33f`_`[clipboard`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Clipboard_(software)]`_`f.
• Smart `F33f`_`[terminal`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Computer_terminal]`_`f handling based on `F33f`_`[terminfo`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Terminfo]`_`f.
• Searchable `F33f`_`[command history`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Command_history]`_`f.
• Web-based configuration (fish_config).
>>Bash/fish translation table
`t
| Feature | Bash syntax |
|---|---|
| variable expansion: with word splitting… | $var or ${var[@]} or ${var[*]} |
| variable expansion: scalar | "$var" |
| variable expansion: array | "${var[@]}" |
| variable expansion: as a space separate… | "${var[*]}" |
| edit line in text editor | Ctrl + X , Ctrl + E |
| evaluate line input | Ctrl + Alt + E |
| history completion | Ctrl + R |
| history substitution | !! |
| explicit subshell | (expression) |
| command substitution | "$(expression)" |
| process substitution | <(expression) |
| logical operators | !cmd && echo FAIL // echo OK |
| variable assignment | var=value |
| string processing: replace | "${HOME/alice/bob}" |
| string processing: remove prefix or suf… | var = a.b.c " ${ var #*. } " #b.c " ${… |
| export variable | export var |
| function-local variable | local var |
| scope-local variable | no equivalent |
| remove variable | unset var |
| check if a variable exists | test -v var |
| array initialization | var=( a b c ) |
| array iteration | for i in " ${ var [@] } " ; do echo " $… |
| argument vector: all arguments | "$@" |
| argument vector: indexing | "$1" |
| argument vector: length | $# |
| argument vector: shift | shift |
| array representation in environment var… | PATH = " $PATH : $HOME /.local/bin" |
| export and run | LANG=C.UTF-8 python3 |
| arithmetic | $((10/3)) |
| escape sequence | $'\\e' |
| single quoted string: escape sequences | 'mom' \\' 's final backslash: \\' |
`t
`t
| Feature | fish syntax |
|---|---|
| variable expansion: with word splitting… | deliberately omitted |
| variable expansion: scalar | deliberately omitted |
| variable expansion: array | $var |
| variable expansion: as a space separate… | "$var" |
| edit line in text editor | Alt + E |
| evaluate line input | — |
| history completion | implicit |
| history substitution | deliberately omitted |
| explicit subshell | fish -c expression |
| command substitution | "$(expression)" or (expression / string… |
| process substitution | (expression / psub) |
| logical operators | not command and echo FAIL or echo OK |
| variable assignment | set var value |
| string processing: replace | string replace alice bob $HOME |
| string processing: remove prefix or suf… | string replace --regex '.*?\\.(.*)' '$1… |
| export variable | set --export var |
| function-local variable | by default |
| scope-local variable | set --local var |
| remove variable | set --erase var |
| check if a variable exists | set --query var |
| array initialization | set var a b c |
| array iteration | for i in $var echo $i end |
| argument vector: all arguments | $argv |
| argument vector: indexing | $argv[1] |
| argument vector: length | (count $argv) |
| argument vector: shift | set --erase argv [ 1 ] |
| array representation in environment var… | set PATH $PATH $HOME /.local/bin |
| export and run | env LANG = C.UTF-8 python3 |
| arithmetic | math '10/3' |
| escape sequence | \\e |
| single quoted string: escape sequences | 'mom \\' s final backslash: \\\\ ' |
`t
`t
| Feature | Comment |
|---|---|
| variable expansion: with word splitting… | Identified as a primary cause of bugs i… |
| variable expansion: scalar | Every variable is an array |
| variable expansion: array | Quoting not necessary to suppress word… |
| variable expansion: as a space separate… | Quoting not necessary to suppress word… |
| edit line in text editor | Upon invocation, moves line input to a… |
| evaluate line input | Evaluates expressions in-place on the l… |
| history substitution | Not discoverable |
| process substitution | Command, not syntax |
| logical operators | Command, not syntax |
| variable assignment | Command, not syntax |
| string processing: replace | Command, not syntax |
| string processing: remove prefix or suf… | Command, not syntax |
| export variable | Options discoverable via tab completion |
| function-local variable | Options discoverable via tab completion |
| scope-local variable | Options discoverable via tab completion |
| remove variable | Options discoverable via tab completion |
| check if a variable exists | Options discoverable via tab completion |
| array initialization | Every variable is an array |
| array iteration | Every variable is an array |
| argument vector: all arguments | Every variable is an array |
| argument vector: indexing | Every variable is an array |
| argument vector: length | Every variable is an array |
| argument vector: shift | Every variable is an array |
| array representation in environment var… | fish assumes colon as array delimiter f… |
| export and run | env LANG = C.UTF-8 python3 works in any… |
| arithmetic | expr 10 / 3 works in any shell, as expr… |
| escape sequence | printf '\\e' works in both shells; thei… |
| single quoted string: escape sequences | Bash only requires replacement of the s… |
`t
>>See also
• `F33f`_`[Comparison of command shells`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Comparison_of_command_shells]`_`f
• `F33f`_`[Unix`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Unix]`_`f
>>References
`:cite-note-1`!1.`! "fish shell team members". GitHub.com. Retrieved 2021-07-28.
`:cite-note-wikidata-3f79baaa69ca5a772ba0a4786348e99fcbb9de8f-v20-2`!2.`! "Release 4.0.2". 20 April 2025. Retrieved 24 April 2025.
`:cite-note-3`!3.`! "fish-shell 4.0b1, now in Rust". `*fishshell.com`*. Retrieved 18 December 2024.
`:cite-note-4`!4.`! fishshell.com License for fish
`:cite-note-5`!5.`! `F0af`_`[↑`#cite-ref-5]`_`f `:citerefliljencrantz-axel2005`aLiljencrantz, Axel (2005-05-17). "Fish - A user-friendly shell". `F33f`_`[Linux Weekly News`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Linux_Weekly_News]`_`f. Retrieved 2010-03-24.
`:cite-note-6`!6.`! `F0af`_`[↑`#cite-ref-6]`_`f "Fish docs: design". Retrieved 2021-04-09.
`:cite-note-7`!7.`! `F0af`_`[↑`#cite-ref-7]`_`f "Writing your own completions". `*fish shell`*. Archived from the original on 2024-08-31.
`:cite-note-8`!8.`! `F0af`_`[↑`#cite-ref-8]`_`f Linux.com. CLI Magic: Enhancing the shell with fish. Retrieved 2010-03-24.
`:cite-note-indepthfish-9`!9.`! `F0af`_`[↑`#cite-ref-indepthfish-9-0]`_`f `:citerefpaul2005`aPaul, Ryan (19 December 2005). "An in-depth look at fish: the friendly interactive shell". `*`F33f`_`[Ars Technica`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Ars_Technica]`_`f`*. Retrieved 10 March 2015. the Posix syntax has several missing or badly implemented features, including variable scoping, arrays, and functions. For this reason, fish strays from the Posix syntax in several important places.
`:cite-note-bash-pitfalls-10`!5.`! "Bash Pitfalls". Retrieved 2016-07-10. This page shows common errors that Bash programmers make. (...) You will save yourself from many of these pitfalls if you simply always use quotes and never use word splitting for any reason! Word splitting is a broken legacy misfeature inherited from the Bourne shell that's stuck on by default if you don't quote expansions. The vast majority of pitfalls are in some way related to unquoted expansions, and the ensuing word splitting and globbing that result.
`:cite-note-11`!6.`! "RFC: Add binding to expand/evaluate tokens on commandline". `*`F33f`_`[GitHub`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=GitHub]`_`f`*. 2013-05-16. Retrieved 2021-04-09.
`:cite-note-12`!7.`! "printf does not support \\e". `*fish issues`*. 11 Jul 2013. Retrieved 24 March 2016.
>>External links
• Official website – containing documentation and downloads
• fish on `F33f`_`[GitHub`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=GitHub]`_`f (active)
• fish on `F33f`_`[Gitorious`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Gitorious]`_`f (obsolete)
• fish on `F33f`_`[SourceForge`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=SourceForge]`_`f (obsolete)
• Fish-users – general discussion list for fish users
• Shell Translation Dictionary - another Bash/Fish translation table
`c`F0af`_`[↑ Back to top`#top]`_`f`a